
import Storage from './Storage'

// 获取语言类型
async function getLang(params) {
  const lang = params || (await Storage.get('lang', false)) || 'zh-cn'

  let v
  switch (lang) {
    case 'zh-ch':
      v = require('../assets/lang/zh-cn.json')
      break
    case 'zh-hk':
      v = require('../assets/lang/zh-cn.json')
      break
    case 'en-us':
      v = require('../assets/lang/en-us.json')
      break
    case 'en-gb':
      v = require('../assets/lang/en-gb.json')
      break
    default:
      v = require('../assets/lang/zh-cn.json')
      break
  }
  return v || { _1: true }
}

let v = getLang()
if (v['_1']) v = getLang('zh-cn')

const lang = v
export default lang
